package Test;

import java.util.Scanner;

public class Main02 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int number=input.nextInt();
        int [] arr=new int[number*2];

        int [] arr2=new int[number];
        for (int i=0;i<number*2;i++){
            arr[i]=input.nextInt();
        }
        for(int j=0;j<arr.length;j++){

                int count=0;
                int c=0;
                if(j%2==0){
                    count=arr[j]+arr[j+1]-1;
                }
                for(int i=0;i<arr.length;i+=2){
                    if(arr[i]<=count&&arr[i]>arr[j]){
                        c++;
                    }
                }
                arr2[j/2]=c;
        }
        for (int j:arr2) {
            System.out.print(j);
        }
    }

}
